#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
using namespace std;

const int N = 1e6 + 10, INF = 0x3f3f3f3f;

int n, m;
string s[N];
int sum[N];

int f(int x)
{
    int cnt = 0;
    for (int i = 0;i < n;i++) {
        if (s[i][x] == '1') cnt++;
    }
    return cnt;
}

void solve()
{
    cin >> n >> m;
    for (int i = 0;i < n;i++) cin >> s[i];

    for (int j = 0;j < m;j++) {
        int cnt1 = f(j), cnt0 = n - cnt1;
        if (cnt1 < cnt0) {
            for (int i = 0;i < n;i++)
                if (s[i][j] == '1') sum[i]++;
        } else if (cnt1 > cnt0) {
            for (int i = 0;i < n;i++)
                if (s[i][j] == '0') sum[i]++;
        }
    }

    int p = 0;
    for (int i = 0;i < n;i++)
        if (sum[p] < sum[i]) p = i;

    for (int i = 0;i < n;i++)
        if (sum[p] == sum[i]) cout << i + 1 << ' ';
}

signed main()
{
    //ios::sync_with_stdio(0);
    //cin.tie(0);cout.tie(0);
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    std::istringstream in(R"()");
    std::cin.rdbuf(in.rdbuf());
#endif
    int T = 1;
    //cin>>T;
    for (int i = 1;i <= T;i++) {
        solve();
    }
}